#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
#define rep(i, a, b) for (int i = (a); i <= (b); i++)
#define per(i, a, b) for (int i = (a); i >= (b); i--)
#define endl '\n'
const int N = 1005;

int n, m;
struct Node {
  int t;
  int id;
  bool operator<(Node o) const {
    if (t != o.t) return t < o.t;
    return id < o.id;
  }
} a[N];

int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> n;
  rep(i, 1, n) cin >> a[i].t;
  rep(i, 1, n) a[i].id = i;
  sort(a + 1, a + n + 1);
  ll sum = 0;
  rep(i, 1, n) {
    cout << a[i].id << ' ';
    sum += 1ll * (n - i) * a[i].t;
  }
  cout << endl;
  cout << fixed << setprecision(2) << 1.0 * sum / n;
  return 0;
}